package cn.ml.gaoJi.api.riQi;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class RiLiTest {
    public static void main(String[] args) {
        Date date1 = new Date();
        System.out.println("当前系统时间为："+date1);
        Date date = new Date(System.currentTimeMillis());//当前时间
        System.out.println("当前系统时间为："+date);


        //将日期和时间的格式变为我们要求的额格式：年-月-日
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String tformat = format.format(date);
        System.out.println("格式化之后的日期："+tformat);

        LocalDateTime now = LocalDateTime.now();
        String nowTime1 = now.format(DateTimeFormatter.ofPattern("HHmmssSSS"));
        String nowTime2 = now.format(DateTimeFormatter.ofPattern("ddHHmmssSSS"));
        System.out.println("时间戳"+nowTime1);
        System.out.println("时间戳"+nowTime2);

    }
}
